import java.util.Arrays;

public class Solution1720 {
    public int[] decode(int[] encoded, int first) {
        int[] ans=new int[encoded.length+1];
        ans[0]=first;
        for (int i=1;i<=encoded.length;i++){
            ans[i]=ans[i-1]^encoded[i-1];
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Solution1720().decode(new int[]{1,2,3},1)));
    }
}
